#pragma once

#include "HttpClient.h"

class CSentenceTran
{
public:
    CSentenceTran(void);
    ~CSentenceTran(void);
    
    LPCTSTR DoTranslate(LPCTSTR lpszRawText, LPCSTR lpszFrom, LPCSTR lpszTo);
    
    LPCSTR GetAppID();
    
    LPCSTR GetKey();

    LPCSTR GetSign(LPCSTR lpszRawSign);

    LPCSTR GetSalt();

    LPCSTR GetWebAddress();

    int GBToUTF8(LPCWSTR lpSrc, CHAR* utf8, int nBuffSize);
    
    LPCTSTR EnToZh(LPCTSTR lpszRawText);

    LPCTSTR ZhToEn(LPCTSTR lpszRawText);

    char *php_url_encode(char const *s, int len, int *new_length);

    int json_pase(char* rec_result);

    wstring Utf8Code2String(char* szCode);
    wstring MyUnEscape(char* szUtf8Code);

    int  AnsiToUnicode(LPCSTR pszTxt, LPWSTR lpwsRet, int nSize);

    LPCTSTR GetErrorMsg();

    LPCSTR GetErrorCode();

public:
    wstring m_strTranResult;

    CHAR m_szSalt[7];

    CHAR m_szSign[33];

    static UINT s_nCount;

    static unsigned char s_hexChars[];

    CHttpClient m_httpClient;

    CHAR m_szErrorCode[6];
};
